| Total Complexity | 1 |
| Total Lines | 46 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import { |
||
| 11 | |||
| 12 | @Entity() |
||
| 13 | export class Quote { |
||
| 14 | public static readonly STATUS_DRAFT = 'draft'; |
||
| 15 | public static readonly STATUS_SENT = 'sent'; |
||
| 16 | public static readonly STATUS_REFUSED = 'refused'; |
||
| 17 | public static readonly STATUS_ACCEPTED = 'accepted'; |
||
| 18 | public static readonly STATUS_CANCEL = 'canceled'; |
||
| 19 | |||
| 20 | @PrimaryGeneratedColumn('uuid') |
||
| 21 | private id: string; |
||
| 22 | |||
| 23 | @Column({type: 'varchar', nullable: false}) |
||
| 24 | private status: string; |
||
| 25 | |||
| 26 | @Column({type: 'varchar', nullable: false, unique: true}) |
||
| 27 | private quoteId: string; |
||
| 28 | |||
| 29 | @Column({type: 'timestamp', default: () => 'CURRENT_TIMESTAMP'}) |
||
| 30 | private createdAt: Date; |
||
| 31 | |||
| 32 | @ManyToOne(type => User, {nullable: false}) |
||
| 33 | private owner: User; |
||
| 34 | |||
| 35 | @ManyToOne(type => Customer, {nullable: false}) |
||
| 36 | private customer: Customer; |
||
| 37 | |||
| 38 | @ManyToOne(type => Project, {nullable: true}) |
||
| 39 | private project: Project; |
||
| 40 | |||
| 41 | constructor( |
||
| 42 | quoteId: string, |
||
| 43 | status: string, |
||
| 44 | owner: User, |
||
| 45 | customer: Customer, |
||
| 46 | project?: Project | null |
||
| 47 | ) { |
||
| 48 | this.quoteId = quoteId; |
||
| 49 | this.status = status; |
||
| 50 | this.owner = owner; |
||
| 51 | this.customer = customer; |
||
| 52 | this.project = project; |
||
| 53 | } |
||
| 54 | |||
| 55 | public getId(): string { |
||
| 56 | return this.id; |
||
| 57 | } |
||
| 59 |